const request = require("./http.js");
//添加主播认证
var addanchor = function (data, callback) {
  request({
    url: "/mall/anchorcertification/insert",
    method: "post",
    data: data,
    success: function (res) {
      callback(res);
    },
    fail: function (err) {
      console.log(err);
      wx.showToast({
        title: err.errMsg,
        icon: "none",
        duration: 2000,
      });
    },
  });
};
//添加商家认证
var addbusiness = function (data, callback) {
  request({
    url: "/mall/businesscertification/insert",
    method: "post",
    data: data,
    success: function (res) {
      callback(res);
    },
    fail: function (err) {
      console.log(err);
      wx.showToast({
        title: err.errMsg,
        icon: "none",
        duration: 2000,
      });
    },
  });
};
//查询用户申请主播状态
var getAnchorcertification = function (id, callback) {
    request({
      url: "/mall/anchorcertification/selectCustomerId?customerid=" +id,
      method: "get",
      success: function (res) {
        callback(res);
      },
      fail: function (err) {
        console.log(err);
        wx.showToast({
          title: err.errMsg,
          icon: "none",
          duration: 2000,
        });
      },
    });
  };
  //查询用户申请商家状态
  var getBusinesscertification = function (id, callback) {
      request({
        url: "/mall/businesscertification/selectCustomerId?customerid=" +id,
        method: "get",
        success: function (res) {
          callback(res);
        },
        fail: function (err) {
          console.log(err);
          wx.showToast({
            title: err.errMsg,
            icon: "none",
            duration: 2000,
          });
        },
      });
    };

module.exports = {
  addanchor:addanchor,//添加主播认证
  addbusiness:addbusiness,//添加商家认证
  getAnchorcertification:getAnchorcertification,//查询用户申请主播状态
  getBusinesscertification:getBusinesscertification//查询用户申请商家状态
  
}